##########################################################################
#                                                                        #
#  Ocamlgraph: a generic graph library for OCaml                         #
#  Copyright (C) 2004-2010                                               #
#  Sylvain Conchon, Jean-Christophe Filliatre and Julien Signoles        #
#                                                                        #
#  This software is free software; you can redistribute it and/or        #
#  modify it under the terms of the GNU Library General Public           #
#  License version 2.1, with the special exception on linking            #
#  described in file LICENSE.                                            #
#                                                                        #
#  This software is distributed in the hope that it will be useful,      #
#  but WITHOUT ANY WARRANTY; without even the implied warranty of        #
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                  #
#                                                                        #
##########################################################################

# Where to install the binaries
DESTDIR	=
prefix	=/usr/local
exec_prefix=${prefix}
datarootdir=${prefix}/share
BINDIR	=$(DESTDIR)${exec_prefix}/bin

# Where to install the man page
MANDIR=${datarootdir}/man

# Other variables set by ./configure
OCAMLC   = ocamlc.opt
OCAMLOPT = ocamlopt.opt
OCAMLDEP = ocamldep -slash
OCAMLDOC = ocamldoc.opt
OCAMLLEX = ocamllex.opt
OCAMLYACC= ocamlyacc -v
OCAMLLIB = /usr/local/lib/ocaml
OCAMLBEST= opt
OCAMLVERSION = 4.00.1
OCAMLWEB = true
OCAMLWIN32 = no
OCAMLFIND = ocamlfind
EXE = 
LIBEXT = .a
OBJEXT = .o

# Others global variables
SRCDIR	= src
LIBDIR	= lib

INCLUDES= -I $(SRCDIR) -I $(LIBDIR)
BFLAGS = $(INCLUDES) -g -dtypes
OFLAGS = $(INCLUDES)

# main target
#############

NAME=ocamlgraph

ifeq (no,yes)
all: byte $(OCAMLBEST) viewer dgraph editor
else
all: byte $(OCAMLBEST)
endif

# bytecode and native-code compilation
######################################

LIB= unionfind heap bitv
LIB:=$(patsubst %, $(LIBDIR)/%.cmo, $(LIB))

CMO = 	version util blocks persistent imperative \
	delaunay builder classic rand oper \
	components path nonnegative traverse coloring topological kruskal flow \
        graphviz gml dot_parser dot_lexer dot pack \
	gmap minsep cliquetree mcs_m md strat fixpoint leaderlist contraction
CMO := $(LIB) $(patsubst %, $(SRCDIR)/%.cmo, $(CMO))

CMX = $(CMO:.cmo=.cmx)
CMA = graph.cma
CMXA = graph.cmxa

CMI = sig sig_pack dot_ast
CMI := $(patsubst %, src/%.cmi, $(CMI))

GENERATED = META \
	src/gml.ml src/version.ml \
	src/dot_parser.ml src/dot_parser.mli src/dot_lexer.ml

$(CMX): OFLAGS += -for-pack Graph

byte: $(CMA)
opt: $(CMXA)

graph.cma: graph.cmo
	$(OCAMLC) $(INCLUDES) -a -g -o $@ $^

graph.cmxa: graph.cmx
	$(OCAMLOPT) $(INCLUDES) -a -o $@ $^

graph.cmi: graph.cmo
graph.o: graph.cmx

graph.cmo: $(CMI) $(CMO)
	$(OCAMLC) $(INCLUDES) -pack -g -o $@ $^

graph.cmx: $(CMI) $(CMX)
	$(OCAMLOPT) $(INCLUDES) -pack -o $@ $^

VERSION=1.8.2

src/version.ml: Makefile
	rm -f $@
	echo "let version = \""$(VERSION)"\"" > $@
	echo "let date = \""`date`"\"" >> $@

# gtk2 graph editor
###################

ED_DIR=editor

editor: $(ED_DIR)/editor.byte $(ED_DIR)/editor.$(OCAMLBEST)

ED_CMO = ed_hyper ed_graph ed_draw ed_display ed_main
ED_CMO:= $(patsubst %, $(ED_DIR)/%.cmo, $(ED_CMO))
ED_CMX = $(ED_CMO:.cmo=.cmx)
ED_CMI = $(ED_CMO:.cmo=.cmi)

ED_INCLUDES =  -I +threads -I $(ED_DIR) $(INCLUDES) -I .

$(ED_CMI) $(ED_CMO): BFLAGS+= $(ED_INCLUDES)
$(ED_CMI) $(ED_CMO): $(CMA)
$(ED_CMX): OFLAGS+= $(ED_INCLUDES)
$(ED_CMX): $(CMXA)

$(ED_DIR)/editor.byte: $(CMA) $(ED_CMO)
	$(OCAMLC) -g -o $@ $(ED_INCLUDES) \
		lablgtk.cma lablgnomecanvas.cma unix.cma $^

$(ED_DIR)/editor.opt: $(CMXA) $(ED_CMX)
	$(OCAMLOPT) -o $@ $(ED_INCLUDES) \
		lablgtk.cmxa lablgnomecanvas.cmxa unix.cmxa $^

# gtk2 graph viewer (deprecated)
###################

VIEWER_DIR=view_graph

viewer: $(VIEWER_DIR)/viewgraph.byte $(VIEWER_DIR)/viewgraph.$(OCAMLBEST)

VIEWER_CMO=viewGraph_core viewGraph_select viewGraph_utils viewGraph_test
VIEWER_CMO:=$(patsubst %,$(VIEWER_DIR)/%.cmo, $(VIEWER_CMO))
VIEWER_CMX=$(VIEWER_CMO:.cmo=.cmx)
VIEWER_CMI=$(VIEWER_CMO:.cmo=.cmi)
VIEWER_MLI=$(VIEWER_CMI:.cmi=.mli)

VIEWER_INCLUDES=  -I $(VIEWER_DIR) $(INCLUDES) -I .

$(VIEWER_CMI) $(VIEWER_CMO): BFLAGS+= $(VIEWER_INCLUDES)
$(VIEWER_CMX): OFLAGS+= $(VIEWER_INCLUDES) -for-pack Viewgraph
$(VIEWER_CMI) $(VIEWER_CMO): $(CMA)
$(VIEWER_CMX): $(CMXA)

VIEWER_CMOLIB	= $(VIEWER_DIR)/viewgraph.cmo
VIEWER_CMILIB	= $(VIEWER_DIR)/viewgraph.cmi
VIEWER_CMXLIB	= $(VIEWER_DIR)/viewgraph.cmx

$(VIEWER_CMOLIB): $(filter-out $(VIEWER_DIR)/viewGraph_test.cmo, $(VIEWER_CMO))
	$(OCAMLC) -o $@ $(VIEWER_INCLUDES) -pack $^

$(VIEWER_CMXLIB): $(filter-out $(VIEWER_DIR)/viewGraph_test.cmx, $(VIEWER_CMX))
	$(OCAMLOPT) -o $@ $(VIEWER_INCLUDES) -pack $^

$(VIEWER_DIR)/viewgraph.byte: $(CMA) $(VIEWER_CMOLIB)
	$(OCAMLC) -g -o $@ $(VIEWER_INCLUDES) \
		lablgtk.cma gtkInit.cmo lablgnomecanvas.cma unix.cma $^

$(VIEWER_DIR)/viewgraph.opt: $(CMXA) $(VIEWER_CMXLIB)
	$(OCAMLOPT) -o $@ $(VIEWER_INCLUDES) \
		lablgtk.cmxa gtkInit.cmx lablgnomecanvas.cmxa unix.cmxa $^

# new gtk2 graph viewer: dgraph
###############################

DGRAPH_DIR=dgraph

dgraph: $(DGRAPH_DIR)/dgraph.byte $(DGRAPH_DIR)/dgraph.$(OCAMLBEST)

DGRAPH_CMO=xDotDraw xDot \
	dGraphModel \
	dGraphTreeLayout dGraphSubTree dGraphTreeModel \
	dGraphViewItem dGraphView \
	dGraphRandModel dGraphContainer \
	dGraphViewer
DGRAPH_CMO:=$(patsubst %,$(DGRAPH_DIR)/%.cmo, $(DGRAPH_CMO))
DGRAPH_CMX=$(DGRAPH_CMO:.cmo=.cmx)
DGRAPH_CMI=$(filter-out dgraph/dGraphViewer.cmi, $(DGRAPH_CMO:.cmo=.cmi))

DGRAPH_INCLUDES=  -I $(DGRAPH_DIR) $(INCLUDES) -I .

$(DGRAPH_CMI) $(DGRAPH_CMO): BFLAGS+= $(DGRAPH_INCLUDES)
$(DGRAPH_CMX): OFLAGS+= $(DGRAPH_INCLUDES) -for-pack Dgraph

$(DGRAPH_CMI) $(DGRAPH_CMO): $(CMA)
$(DGRAPH_CMX): $(CMXA)

DGRAPH_CMOLIB	= $(DGRAPH_DIR)/dgraph.cmo
DGRAPH_CMILIB	= $(DGRAPH_DIR)/dgraph.cmi
DGRAPH_CMXLIB	= $(DGRAPH_DIR)/dgraph.cmx


dgraph/dGraphViewer.cmo: $(DGRAPH_CMOLIB)
dgraph/dGraphViewer.cmx: $(DGRAPH_CMXLIB)

$(DGRAPH_CMOLIB): $(filter-out dgraph/dGraphViewer.cmo, $(DGRAPH_CMO))
	$(OCAMLC) -o $@ $(DGRAPH_INCLUDES) -pack $^

$(DGRAPH_CMXLIB): $(filter-out dgraph/dGraphViewer.cmx, $(DGRAPH_CMX))
	$(OCAMLOPT) -o $@ $(DGRAPH_INCLUDES) -pack $^

$(DGRAPH_DIR)/dgraph.byte: $(CMA) $(DGRAPH_CMOLIB) \
  $(DGRAPH_DIR)/dGraphViewer.cmo
	$(OCAMLC) -g -o $@ $(DGRAPH_INCLUDES) \
		lablgtk.cma gtkInit.cmo lablgnomecanvas.cma $^

$(DGRAPH_DIR)/dgraph.opt: $(CMXA) $(DGRAPH_CMXLIB) \
  $(DGRAPH_DIR)/dGraphViewer.cmx
	$(OCAMLOPT) -o $@ $(DGRAPH_INCLUDES) \
		lablgtk.cmxa gtkInit.cmx lablgnomecanvas.cmxa $^

# Examples
##########

EXAMPLESBIN=bin/demo.$(OCAMLBEST) bin/demo_planar.$(OCAMLBEST) \
  bin/bench.$(OCAMLBEST) bin/color.$(OCAMLBEST) bin/sudoku.$(OCAMLBEST) \
  bin/test.$(OCAMLBEST)

.PHONY: examples
examples: $(EXAMPLESBIN)

.PHONY: demo
demo: bin/demo.$(OCAMLBEST)

bin/demo.byte: $(CMA) examples/demo.cmo
	$(OCAMLC) -o $@ $^

bin/demo.opt: $(CMXA) examples/demo.cmx
	$(OCAMLOPT) -o $@ $^

bin/demo_planar.byte: $(CMA) examples/demo_planar.cmo
	$(OCAMLC) -o $@ graphics.cma unix.cma $^

bin/demo_planar.opt: $(CMXA) examples/demo_planar.cmx
	$(OCAMLOPT) -o $@ graphics.cmxa unix.cmxa $^

bin/color.byte: $(CMA) examples/color.cmo
	$(OCAMLC) -o $@ graphics.cma unix.cma $^

bin/color.opt: $(CMXA) examples/color.cmx
	$(OCAMLOPT) -o $@ graphics.cmxa unix.cmxa $^

bin/sudoku.byte: $(CMA) examples/sudoku.cmo
	$(OCAMLC) -o $@ graphics.cma unix.cma $^

bin/sudoku.opt: $(CMXA) examples/sudoku.cmx
	$(OCAMLOPT) -o $@ graphics.cmxa unix.cmxa $^

test: $(CMA) tests/test.ml
	ocaml unix.cma graphics.cma $^

test-bf: $(CMA) tests/test_bf.ml
	ocaml unix.cma graphics.cma $^

bin/test_bf.byte: $(CMA) tests/test_bf.ml
	$(OCAMLC) -g -o $@ unix.cma graphics.cma $^

bin/test.byte: $(CMA) tests/test.cmo
	$(OCAMLC) -g -unsafe -o $@ unix.cma graphics.cma $^

bin/test.opt: $(CMXA) tests/test.cmx
	$(OCAMLOPT) -unsafe -inline 100 -o $@ unix.cmxa graphics.cmxa $^

bench: bin/bench.$(OCAMLBEST)
	bin/bench.opt

bin/bench.opt: $(CMXA) tests/bench.ml
	$(OCAMLOPT) -unsafe -inline 100 -o $@ unix.cmxa $^

check: $(CMA) tests/check.ml
	ocaml $^

# Additional rules
##################

EXAMPLES = demo color demo_planar sudoku
EXAMPLESBIN:=$(patsubst %, bin/%.opt, $(EXAMPLES))
EXAMPLES:= $(patsubst %, examples/%.ml, $(EXAMPLES))

examples: $(EXAMPLESBIN)

TESTS = test check
TESTS := $(patsubst %, tests/%.ml, $(TESTS))

DPD_GRAPH_ML= $(TESTS) $(EXAMPLES)

$(DPD_GRAPH_ML:.ml=.cmo): $(CMA)
$(DPD_GRAPH_ML:.ml=.cmx): $(CMXA)

# installation
##############

INSTALL_LIBDIR=$(DESTDIR)$(OCAMLLIB)/ocamlgraph

install: install-$(OCAMLBEST) install-byte
	mkdir -p $(BINDIR)
ifeq (no,yes)
ifeq ($(OCAMLBEST),byte)
	cp -f $(BINDIR)/graph-editor.byte $(BINDIR)/graph-editor$(EXE)
	cp -f $(BINDIR)/graph-viewer.byte $(BINDIR)/graph-viewer$(EXE)
else
	cp -f $(BINDIR)/graph-editor.opt $(BINDIR)/graph-editor$(EXE)
	cp -f $(BINDIR)/graph-viewer.opt $(BINDIR)/graph-viewer$(EXE)
endif
endif

install-byte:
	mkdir -p $(INSTALL_LIBDIR)
	cp -f graph.cmo graph.cmi $(CMA) $(INSTALL_LIBDIR)
	cp -f $(SRCDIR)/*.mli $(INSTALL_LIBDIR)
ifeq (no,yes)
	mkdir -p $(BINDIR)
	cp -f $(ED_DIR)/editor.byte $(BINDIR)/graph-editor.byte
	cp -f $(VIEWER_CMILIB) $(VIEWER_CMOLIB) $(INSTALL_LIBDIR)
	cp -f $(DGRAPH_CMILIB) $(DGRAPH_CMOLIB) $(INSTALL_LIBDIR)
	cp -f $(VIEWER_DIR)/*.mli $(DGRAPH_DIR)/*.mli $(INSTALL_LIBDIR)
	cp -f $(DGRAPH_DIR)/dgraph.byte $(BINDIR)/graph-viewer.byte
endif

install-opt: install-byte
	mkdir -p $(INSTALL_LIBDIR)
	cp -f graph$(LIBEXT) graph.cmi graph.cmx $(CMXA) $(INSTALL_LIBDIR)
	cp -f $(SRCDIR)/*.mli $(INSTALL_LIBDIR)
ifeq (no,yes)
	mkdir -p $(BINDIR)
	cp -f $(ED_DIR)/editor.opt $(BINDIR)/graph-editor.opt
	cp -f $(VIEWER_CMILIB) $(VIEWER_CMXLIB) $(VIEWER_CMXLIB:.cmx=.o) \
		$(INSTALL_LIBDIR)
	cp -f $(DGRAPH_CMILIB) $(DGRAPH_CMXLIB) $(DGRAPH_CMXLIB:.cmx=.o) \
		$(INSTALL_LIBDIR)
	cp -f $(DGRAPH_DIR)/dgraph.opt $(BINDIR)/graph-viewer.opt
	cp -f $(VIEWER_DIR)/*.mli $(DGRAPH_DIR)/*.mli $(INSTALL_LIBDIR)
endif

install-findlib: META
ifdef OCAMLFIND
ifeq (no,yes)
	$(OCAMLFIND) install ocamlgraph META \
		$(SRCDIR)/*.mli $(VIEWER_DIR)/*.mli $(DGRAPH_DIR)/*.mli \
		graph$(LIBEXT) graph.cmx graph.cmo graph.cmi $(CMA) $(CMXA) \
		$(VIEWER_CMXLIB) $(VIEWER_CMOLIB) $(DGRAPH_CMXLIB) \
		$(DGRAPH_CMOLIB)
else
	$(OCAMLFIND) install ocamlgraph META \
		$(SRCDIR)/*.mli $(VIEWER_DIR)/*.mli $(DGRAPH_DIR)/*.mli \
		graph$(LIBEXT) graph.cmx graph.cmo graph.cmi $(CMA) $(CMXA)
endif
endif

META: META.in Makefile
	sed -e s/VERSION/$(VERSION)/ -e s/CMA/$(CMA)/ -e s/CMXA/$(CMXA)/ \
		$@.in > $@

# documentation
###############

DOCFILES=$(NAME).ps $(NAME).html

NODOC	= blocks dot_parser dot_lexer version
NODOC	:= $(patsubst %, $(SRCDIR)/%.cmo, $(NODOC))
DOC_CMO	= $(filter-out $(NODOC) $(LIB), $(CMO))
DOC_SRC	= $(CMI:.cmi=.mli) $(DOC_CMO:.cmo=.mli) $(DOC_CMO:.cmo=.ml)
ifeq (no,yes)
DOC_SRC := $(DOC_SRC) $(DGRAPH_CMI:.cmi=.mli)
endif

.PHONY: doc
doc: $(DOC_CMO)
	mkdir -p doc
	rm -f doc/*
	$(OCAMLDOC) -d doc -html $(DGRAPH_INCLUDES) $(DOC_SRC)

# literate programming
$(NAME).tex: $(DOC_SRC)
	$(OCAMLWEB) -o $@ $^

wc:
	ocamlwc -p $(SRCDIRC)/*.mli $(SRCDIRC)/*.ml

# file headers
##############

headers:
	headache \
	   -c misc/headache_config.txt \
	   -h misc/header.txt \
	   Makefile.in configure.in README \
	   $(LIBDIR)/*.ml $(LIBDIR)/*.ml[ily] \
	   $(SRCDIR)/*.ml $(SRCDIR)/*.ml[ily] \
	   $(ED_DIR)/*.ml $(ED_DIR)/*.mli
	headache \
           -c misc/headache_config.txt \
	   -h $(DGRAPH_DIR)/headers/CEA_LGPL \
	   $(DGRAPH_DIR)/*.ml $(DGRAPH_DIR)/*.mli
# export
########

EXPORTDIR=$(NAME)-$(VERSION)
TAR=$(EXPORTDIR).tar

FTP = /users/www-perso/projets/ocamlgraph/download
WWW = /users/www-perso/projets/ocamlgraph

FILES = src/*.ml* lib/*.ml* Makefile.in configure configure.in META.in  \
	.depend editor/ed_*.ml* editor/Makefile \
        editor/tests/*.dot editor/tests/*.gml \
	view_graph/*.ml view_graph/*.mli \
	view_graph/README view_graph/Makefile \
	dgraph/*.ml dgraph/*.mli \
	examples/*.ml tests/*.ml \
	README FAQ CREDITS INSTALL COPYING LICENSE CHANGES

export: source export-doc export-web export-delaunay

source:
	mkdir -p export
	cd export; rm -rf $(EXPORTDIR)
	mkdir -p export/$(EXPORTDIR)/bin
	cp --parents $(FILES) export/$(EXPORTDIR)
	cd export ; tar cf $(TAR) $(EXPORTDIR) ; gzip -f --best $(TAR)
	cp export/$(TAR).gz $(FTP)
	cp README FAQ CREDITS COPYING LICENSE CHANGES $(EXAMPLES) $(FTP)

# Build and install the .tar.gz requiered by Frama-C
framac: EXPORTDIR=ocamlgraph
framac: FTP=$$HOME/frama-c
framac:
	mkdir -p export
	cd export; rm -rf $(EXPORTDIR)
	mkdir -p export/$(EXPORTDIR)/bin
	cp --parents $(FILES) export/$(EXPORTDIR)
	cd export ; tar cf $(TAR) $(EXPORTDIR) ; gzip -f --best $(TAR)
	cp export/$(TAR).gz $(FTP)
	make -C $(FTP) force-ocamlgraph

www/version.prehtml: Makefile.in
	echo "<#def version>$(VERSION)</#def>" > www/version.prehtml

export-web: www/version.prehtml
	make -C www install

export-doc: $(DOC_CMO)
	rm -f $(WWW)/doc/*
	-$(OCAMLDOC) -d $(WWW)/doc -html $(DGRAPH_INCLUDES) $(DOC_SRC)

MISCFTP = $(HOME)/WWW/ftp/ocaml/misc
DELAUNAY=delaunay.ml delaunay.mli
export-delaunay:
	cd src; cp -f $(DELAUNAY) $(MISCFTP)
	cd src; rm -f delaunay.annot; caml2html -noannot -d $(MISCFTP) $(DELAUNAY)

# generic rules
###############

.SUFFIXES: .mli .ml .cmi .cmo .cmx .mll .mly .tex .dvi .ps .html

.mli.cmi:
	$(OCAMLC) -c $(BFLAGS) $<

.ml.cmo:
	$(OCAMLC) -c $(BFLAGS) $<

.ml.o:
	$(OCAMLOPT) -c $(OFLAGS) $<

.ml.cmx:
	$(OCAMLOPT) -c $(OFLAGS) $<

.mll.ml:
	$(OCAMLLEX) $<

.mly.ml:
	$(OCAMLYACC) -v $<

.mly.mli:
	$(OCAMLYACC) -v $<

.tex.dvi:
	latex $< && latex $<

.dvi.ps:
	dvips $< -o $@

.tex.html:
	hevea $<

# Emacs tags
############

otags:
	otags -r src editor view_graph

tags:
	find . -name "*.ml*" | sort -r | xargs \
	etags "--regex=/let[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/let[ \t]+rec[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/and[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/type[ \t]+\([^ \t]+\)/\1/" \
              "--regex=/exception[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/val[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/module[ \t]+\([^ \t]+\)/\1/"

# Makefile is rebuilt whenever Makefile.in or configure.in is modified
######################################################################

Makefile: Makefile.in config.status
	if test -e $@; then chmod a+w $@; fi
	./config.status
	chmod a-w $@

config.status: configure
	./config.status --recheck

configure: configure.in
	autoconf

# clean
#######

clean:
	rm -f *~
	for d in $(SRCDIR) $(LIBDIR) $(ED_DIR) $(VIEWER_DIR) $(DGRAPH_DIR) \
		tests examples; \
	do \
	  rm -f $$d/*.cm[iox] $$d/*$(OBJEXT) $$d/*~ $$d/*.annot; \
	done
	rm -f $(GENERATED) $(SRCDIR)/dot_parser.output
	rm -f graph.*a graph.cm* graph.o graph$(LIBEXT)
	rm -f $(ED_DIR)/editor.byte $(ED_DIR)/editor.opt
	rm -f $(VIEWER_DIR)/viewgraph.byte $(VIEWER_DIR)/viewgraph.opt
	rm -f $(DGRAPH_DIR)/dgraph.byte $(DGRAPH_DIR)/dgraph.opt
	rm -f $(DGRAPH_DIR)/dgraph
	rm -f *.haux *.aux *.log $(NAME).tex $(NAME).dvi $(DOCFILES)
	rm -f $(EXAMPLESBIN)

dist-clean distclean:: clean
	rm -f Makefile config.cache config.log config.status *.byte *.opt

svnclean svn-clean:: dist-clean
	rm -f config.* configure configure.lineno

# depend
########

.PHONY: depend
.depend depend: $(GENERATED)
	rm -f .depend
	$(OCAMLDEP) $(INCLUDES) -I $(ED_DIR) -I $(VIEWER_DIR) -I $(DGRAPH_DIR)\
		$(LIBDIR)/*.ml $(LIBDIR)/*.mli \
		$(SRCDIR)/*.ml $(SRCDIR)/*.mli \
		$(ED_DIR)/*.mli $(ED_DIR)/*.ml \
		$(VIEWER_DIR)/*.mli $(VIEWER_DIR)/*.ml \
		$(DGRAPH_DIR)/*.mli $(DGRAPH_DIR)/*.ml > .depend

include .depend
